from passlib.context import CryptContext

bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto')


# 密码加密
def hash_password(password: str) -> str:
    return bcrypt_context.hash(password)


# 验证密码
def check_password(password: str, hashed_password: str) -> bool:
    return bcrypt_context.verify(password, hashed_password)

